home *** CD-ROM | disk | FTP | other *** search
- Path: mstephens.gsfc.nasa.gov!user
- From: mark.stephens@gsfc.nasa.gov (mark stephens)
- Newsgroups: comp.arch.embedded,comp.lang.c
- Subject: Re: Using malloc of C on embedded system?
- Date: Mon, 01 Apr 1996 13:40:27 -0500
- Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
- Message-ID: <mark.stephens-0104961340270001@mstephens.gsfc.nasa.gov>
- References: <4jml7h$cbc@castor.usc.edu>
- NNTP-Posting-Host: mstephens.gsfc.nasa.gov
-
- You also might consider having many "mallocs" for each type of data
- structure you have. I use a simple array of structures and a free list
- composted of bytes. When a structure is allocated, it's corresponding bit
- is set in the free/used list. Deallocation is the reverse. Structures
- are allocated by liner search of the free list.
-
- The restrictions are you have to know the maximum number of structures
- used at any one time. If you can know this, you will not run out of heap
- and/or have the heap fractionated. You run out of heap and your systems
- runs out on you!
-
- mark
-
- --
- mark stephens mark.stephens@gsfc.nasa.gov
- code 521.2 (301) 286-4269
- NASA/GSFC
- Greenbelt, MD 20771
-